import request from '@/utils/request'
import { CHECC_API_CMS ,CHECC_API_PROCESS} from '@/constants/proxy'

/*
 * 菜单管理模块
 */

// 保存
export const saveMenu = (data) => {
  return request({
    url: CHECC_API_CMS + '/menu',
    method: 'post',
    data
  })
}
// 删除
export const deleteMenu = (id) => {
  return request({
    url: CHECC_API_CMS + '/menu/' + id,
    method: 'delete'
  })
}
// 查找导航菜单树
export const getMenuTree = (params) => {
  return request({
    url: CHECC_API_CMS + '/menu',
    method: 'get',
    params
  })
}

// 获取路由
export const getRouters = () => {
  return request({
    url: CHECC_API_CMS + '/menu/getRouters',
    method: 'get'
  })
}
// 获取菜单列表
export const getMenus = () => {
  return request({
    url: CHECC_API_CMS + '/menu/getMenus',
    method: 'get'
  })
}

// 更新菜单
export function updateMenu(data) {
  return request({
    url: CHECC_API_CMS + '/menu',
    method: 'put',
    data: data
  })
}

export function getChildrenMenu(menuId) {
  return request({
    url: CHECC_API_CMS + '/menu/getMenuListById',
    method: "get",
    params: {
      menuId,
    }
  })
}
//获取流程标识下拉数据
export const processIden = () => {
  return request({
    url: CHECC_API_PROCESS + '/proc-center-process-define/listAll',
    method: 'post',
    data:{}
  })
}